import request from '@/utils/request'

/**
 * 收藏接口
 * @method getList 获取所有收藏
 * @method save 收藏
 * @method cancel 取消收藏
 */
export function useFavoriteApi() {
  const basePath = '/admin/favorite'

  const getList = () => {
    return request({
      url: `${basePath}/list`,
      method: 'get'
    })
  }

  const save = (data) => {
    return request({
      url: `${basePath}/save`,
      method: 'post',
      data
    })
  }

  const cancel = (attractionId) => {
    return request({
      url: `${basePath}/cancel/${attractionId}`,
      method: 'get'
    })
  }

  return {
    getList,
    save,
    cancel
  }
}
